<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFileTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('file', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->string('file_name', 255)->comment('文件名称');
            $table->string('file_key', 255)->nullable()->comment('生成的文件key');
            $table->string('extension', 255)->nullable()->comment('文件拓展名');
            $table->string('file_path', 1024)->comment('文件路径');
            $table->string('file_dir', 1024)->comment('文件存储路径');
            $table->bigInteger('file_size')->nullable()->comment('文件大小');
            $table->bigInteger('user_id')->nullable()->default(0);
            $table->integer('deleted')->nullable()->default(0);
            $table->timestamp('created_at')->nullable()->useCurrent();
            $table->timestamp('updated_at')->useCurrentOnUpdate()->nullable()->useCurrent();
            $table->bigInteger('creator_id')->nullable()->default(0);
            $table->bigInteger('updater_id')->nullable()->default(0);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('file');
    }
};
